﻿@model SubjectDetailModel
@{
    CssLink.Add("~/Content/css/subjectDetail.css");
    CssLink.Add("~/Content/css/attachment.css");
}

@{ Html.RenderPartial("_주제편집명령", Model); }

<h1 class="주제제목">@Model.주제.제목</h1>
<div class="주제코드">@Model.주제.코드</div>

@if (Model.주제.제거) { 
    <div class="alert alert-error">제거된 주제입니다.</div>
}
<hr />

<div class="주제목록">
    <div>상위주제:</div>
    <div>
        @foreach(var 상위주제 in Model.상위주제목록) {
            <a href="@Url.SubjectDetail(상위주제.ID)" class="btn btn-small btn-success" >@상위주제.제목</a>
        }
    </div>
</div>

@if(Model.하위주제목록.Count > 0) {
    <div class="주제목록">
        <div>하위주제:</div>
        <div>
            @foreach(var 하위주제 in Model.하위주제목록) {
                <a href="@Url.SubjectDetail(하위주제.ID)" class="btn btn-small btn-info" >@하위주제.제목</a>
            }
        </div>
    </div>
}

<hr />
<h2>목차</h2>

<table class="table table-condensed table-bordered" id="주제목차">
    <thead>
        <tr><th></th>
            <th>글 제목</th>
            <th>작성자</th>
            <th>편집일</th></tr>
    </thead>
    <tbody>
        @{ int 번호 = 1; }
        @foreach(var 글 in Model.글목록) {            
            <tr onclick="document.location='#@글.코드';">
                <td>@(번호++).</td>
                <td>
                    @글.제목 
                    @if (글.전산소만) { <span class="mytag">전산소</span> }
                </td>
                <td>@글.작성자</td>
                <td>@글.생성일.ToYMDHM()</td>
            </tr>
        }
    </tbody>
</table>

@foreach(var 글 in Model.글목록) {
    <a id="@글.코드"></a>
    <hr />
    Html.RenderPartial("_글편집명령", 글);
    <div class="글제목">
        <i class="icon-play"></i>
        @글.제목            
        @if (글.전산소만) { <span class="mytag">전산소</span> }
    </div>
    <div id="첨부파일목록_@글.ID" class="첨부파일목록">
        @{ Html.RenderAction_FileList(글.ID, 1); }
    </div>
    <div class="글내용">
        @Html.Raw(글.내용)
    </div>
}

@Html.Partial("../Comment/_Main", new CommentMainModel { 대상구분 = Consts.덧글대상_주제, 대상ID = Model.주제.ID })
@Html.Partial("_주제선택대화상자")
@Html.Partial("_책갈피그룹선택대화상자")
@Html.Partial("_파일첨부대화상자")
@Html.Partial("_PromptDialog")

<script type="text/javascript">
    $(SubjectDetail_init);
</script>

